<template>
    <div class="hcontent">
        <h3>{{news.title}}</h3>
        <p class="time"><span>发表时间:{{news.add_time|timeformat}}</span><span>点击{{news.click}}次</span></p>
        <hr>
        <div class="ncontent"  v-html="news.content"></div>
        <comment :id="id"></comment>
    </div>
</template>
<script>
//import { component } from 'vue/types/umd';
import comment from "./coment.vue"
export default {
    //路由传过来的参数
     props: ['id'],
     data(){
        return{
            news:{}
        }
     },
     methods:{
        async getnews(){
           const {data}  = await this.axios.get("/api/getnew/" + this.id);
           if(data.status===0){
               this.news=data.message[0];
           }
    
        }
     },
     created(){
         this.getnews();
     },
     components:{
        comment
     }
}
</script>
<style  scoped>
.hcontent h3{
    font-size: 15px;
    text-align: center;
    color: red;
    margin: 15px 0;
}
.hcontent{
    border: 1px solid #fff;
}
.time{
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
}
</style>